<template>
	<view class="contain">
		<view class="flex flex-col activitysList" v-for="item in activitysList.data" @click="preViewImage(item)">
			<view class="flex justify-between mt-2 mb-2">
				<view class="w-[70%] big blod">{{item.adname}}</view>
				<view class="w-[30%] small blod flex justify-end items-end">{{formatTime(item.createtime)}}</view>
			</view>
			<view class="photo">
				<image :src="item.adimgurl" mode="widthFix"></image>
			</view>
		</view>
	</view>
</template>

<script setup lang='ts'>
import { ref,reactive } from 'vue'
import {  onLoad } from '@dcloudio/uni-app'
import { userStore } from '@/stores/userStore'
let store = userStore();	
let { hasLogin,userData } = userStore();

let activitysList=reactive<any>({data:[]});	

/* 获取海报活动 */
const getActivitys=()=>{
	uni.showLoading({
		title:"加载中..."
	})
	let paraData={}
	console.log("课程参数:",paraData);
	uni.$tools.Reqeust('/api/getActivitys',paraData,'POST').then((res:any)=>{
		console.log('课程返回:==>',res);
		if (res.data.code == 200) {
			uni.hideLoading();
			activitysList.data=res.data.data;
		}else{
			uni.hideLoading();
		}
	})	
}

const formatTime=(inputTime:String)=>{
	return inputTime.split(" ")[0];
}

/* 预览海报 */
const preViewImage=(item:any)=>{
	// 预览图片
	uni.previewImage({
		urls: [item.adimgurl],
		current:item.adimgurl
	});	
}

onLoad(()=>{
	getActivitys();
});
</script>

<style lang='scss' scoped>
	@import "activitys.scss";
</style>